package com.hqyj.fj.javaSpringBoot.modules.account.dao;

import com.hqyj.fj.javaSpringBoot.modules.account.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserDao {


    @Select("select * from account_user where id = #{id}")
    @Results(id="userResult", value={
            @Result(column="id", property="id"),
            @Result(column="id",property="roles",
                    javaType= List.class,
                    many=@Many(select="com.hqyj.fj.javaSpringBoot.modules.account.dao.RoleDao.getRolesByUserId"))
    })
    User getUserById(@Param("id") int id);

}
